class TrophyRoomsController < ApplicationController
  def show
    count=5
    @runner = Runner.find(params[:id])
    return self.unauthorized unless self.current_user.can('view:runner', @runner)
#    package_id = @runner.package.id
    if (not @runner.blank?)
      @distance = @runner.distance_cache
      @incentives = Incentive.find(:all, :order => "goal DESC", :limit => '4', :conditions => ["goal <= ?", @distance]).reverse
      count = count - @incentives.length
      @next_incentives = Incentive.find(:all, :order => "goal ASC", :limit => count, :conditions => ["goal > ?", @distance])
#      @incentives = Incentive.find(:all, :conditions => ["goal <= ? and package_id = ?", (distance, package_id)])
#      @next = Incentive.find(:first, :conditions => ["goal > ? and package_id =?", (distance, package_id)])
    end
    add_page_token("Trophy Room")
    
  end
end
